package br.com.millenium.service.cliente.processaction;

import lumis.doui.processaction.ProcessActionHandler;
import lumis.portal.PortalException;
import br.com.millenium.domain.manager.MilleniumManagerFactory;

@SuppressWarnings("rawtypes")
public class CheckDuplicateFilialProcessActionHandler extends ProcessActionHandler
{
	@Override
	public void processAction() throws PortalException 
	{
		String filialCodigo = (String)getParameter ( "codigoFilial" );
		String filialCNPJ   = (String)getParameter ( "cnpj"         );
		String filialId     = (String)(getParameter( "id"           ) == null ? "" : getParameter( "id" ));
		
		if( MilleniumManagerFactory.getClienteManager().isDuplicateFilial(filialId, filialCodigo, filialCNPJ, transaction))
			throw new PortalException( "STR_FILIAL_EXISTS;", getResource() );
	}
}
